﻿using Emgu.CV.Flann;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CameraClient.CForm.CameraF
{
    public class CChartShowData
    {
        public CChartShowData() { }

        public string Name { get; set; }

        public string Data { get; set; }
        public List<string> WenduOnes { get; set; }


        public string DataStr
        {
            get
            {
                string reuslt = "";
                int index = 0;
                foreach (var item in WenduOnes)
                {
                    if (index == 0) { reuslt = item.ToString(); }
                    else
                    {
                        reuslt = reuslt + "," + item.ToString();
                    }
                    index= index+ 1;
                }
                string dataItem = " { name: '" + Name + "', data: [" + reuslt + "]}";

                return dataItem;
            }
        }
    }




    public class CChartHelper
    {



        public static CChartShowDto GetShowQuXianData(List<CChartShowData> CChartShowDataList)
        {
            CChartShowDto outDto = new CChartShowDto();

            if (CChartShowDataList != null)
            {
                //             // xAxisList: ['14:00', '15:00', '16:00', '17:00', '18:00'],
                //             xAxisList: [{ &Xzhou &}],
                //// legend: ['温度', '温度1'],
                //             legend: [{ &xianTitle &} ],
                //             series: [{ &xianseries &} ]
                string quXianTitle = "";
                string quXianSeries = "";
                foreach (var item in CChartShowDataList)
                {
                    if (string.IsNullOrEmpty(quXianTitle))
                    { quXianTitle = "'" + item.Name + "'"; }
                    else { quXianTitle = quXianTitle + ",'" + item.Name.ToString() + "'"; }


                    if (string.IsNullOrEmpty(quXianSeries))
                    { quXianSeries = "" + item.DataStr + ""; }
                    else { quXianSeries = quXianSeries + "," + item.DataStr.ToString() + ""; }


                }
                outDto.QuXianSeries = quXianSeries;
                outDto.QuXianTitle = quXianTitle;

            }


            return outDto;
        }

    }

    public class CChartShowDto
    {
        public string QuXianTitle { get; set; }
        public string QuXianSeries { get; set; }

        public string Xzhou { get; set; }


        public string YMax { get; set; }

        public string YMin { get; set; }

    }
}
